package cn.gjxblog.aop.proxy.spring.demo3;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * 切面
 *
 *
 */

@Aspect
public class UserAspect {

    @Pointcut("execution(* cn.gjxblog.aop.proxy.spring.demo1.*.*(..))")
    public void point(){

    }

    @Before("point()")
    public void before(){
        System.out.println("method invoke Before......");
    }

    @After("point()")
    public void After(){
        System.out.println("method invoke After.......");
    }

    @AfterReturning("point()")
    public void AfterReturning(){
        System.out.println("method invoke AfterReturning.......");
    }


    @AfterThrowing("point()")
    public void AfterThrowing(){
        System.out.println("method invoke AfterThrowing.......");
    }


    @Around("point()")
    public void Around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("method invoke Around.......");
        Object proceed = joinPoint.proceed();
        System.out.println(proceed);
        System.out.println("method invoke Around2.......");
    }
}
